//
//  UserModel.h
//  DoctorQA
//
//  Created by sally on 16/6/20.
//  Copyright © 2016年 talecare. All rights reserved.
//

#import "AccountInterface.h"
#import "BussinessModel.h"

/**
 *  用户实体
 */
@class UserData;
@interface UserModel : BussinessModel

@property (nonatomic, strong) UserData *user_data;
@property (nonatomic, assign) NSInteger created_at;
@property (nonatomic, assign) NSInteger updated_at;
@property (nonatomic, assign) NSInteger uid;

//发送验证码
+ (void)sendCaptchaWithPhone:(NSString *)phone
                  completion:(void (^)(BOOL isSucceed))completion;

//验证验证码并注册
+ (void)registerWithPhone:(NSString *)phone
                  captcha:(NSString *)captcha
                 password:(NSString *)password
               completion:(void (^)(UserModel *user))completion;

//完善用户资料
+ (void)updateUserInfoWithUserName:(NSString *)userName
                    userProfilePic:(NSString *)userProfilePic
                      locationName:(NSString *)locationName
                            bigPic:(NSString *)bigPic
                           proDesc:(NSString *)proDesc
                          proTitle:(NSString *)proTitle
                        topicIndex:(NSString *)topicIndex
                       topicIndex2:(NSString *)topicIndex2
                        completion:(void (^)(UserModel *user))completion;

//登录
+ (void)loginWithPhone:(NSString *)phone
              password:(NSString *)password
            completion:(void (^)(UserModel *user))completion;

//设置用户密码
+ (void)modifyPswWithPhone:(NSString *)phone
               oldPassword:(NSString *)oldPassword
                  password:(NSString *)password
                confirmPwd:(NSString *)confirmPwd
                completion:(void (^)(BOOL isSucceed))completion;

//重置用户密码
+ (void)resetPswWithPhone:(NSString *)phone
                 password:(NSString *)password
                  captcha:(NSString *)captcha
               completion:(void (^)(BOOL isSucceed))completion;

//收藏专家到心愿单
+ (void)collectExpertWithProUid:(NSInteger)proUid
                     completion:(void (^)(BOOL isSucceed))completion;

//取消收藏专家
+ (void)cancelCollectExpertWithProUid:(NSInteger)proUid
                           completion:(void (^)(BOOL isSucceed))completion;

//用户反馈
+ (void)submitFeedbackWithPhone:(NSString *)phone
                        content:(NSString *)content
                     completion:(void (^)(BOOL isSucceed))completion;

//当前用户信息接口
+ (void)quaryUserInfoWithCompletion:(void (^)(UserModel *user))completion;

//提现绑定支付宝
+ (void)bindAlipayWithAlipay:(NSString *)alipay
                  completion:(void (^)(UserModel *user))completion;

@end

@interface UserData : BussinessModel

@property (nonatomic, strong) NSString *user_pro_topic_index2;
@property (nonatomic, strong) NSString *user_profile_pic;
@property (nonatomic, strong) NSString *work_experience;
@property (nonatomic, strong) NSString *user_pro_topic_index;
@property (nonatomic, strong) NSString *user_profile_bg_pic;
@property (nonatomic, assign) NSInteger is_avaliable;
@property (nonatomic, strong) NSString *user_location_desc;
@property (nonatomic, assign) NSInteger is_pro;                //1是专家，0是普通
@property (nonatomic, assign) NSInteger book_consulting_count; //见过专家的数量
@property (nonatomic, strong) NSString *user_location_code;
@property (nonatomic, strong) NSString *user_location_name;
@property (nonatomic, strong) NSString *user_name;
@property (nonatomic, strong) NSString *user_pro_desc;  //长文本描述
@property (nonatomic, strong) NSString *user_pro_title; //简短描述
@property (nonatomic, assign) BOOL new_user; //是否是新用户

@property (nonatomic, strong) NSString *pro_user_email;
@property (nonatomic, assign) NSInteger like_count; //收藏（想见）的数量
@property (nonatomic, assign) NSInteger is_liked;   //1 表示收藏过
@property (nonatomic, strong) NSString *serving_company;
@property (nonatomic, strong) NSString *education;
@property (nonatomic, strong) NSString *phone;
@property (nonatomic, assign) NSInteger pro_consulting_available;//专家是否可约，1可约0不可约
@property (nonatomic, strong) NSString *alipay; //支付宝账号

@property (nonatomic, assign) NSInteger pro_user_consulting_count; //约见次数
@property (nonatomic, strong) NSString *user_profile_big_pic;
@property (nonatomic, assign) NSInteger pro_user_consulting_value; //评分

@end

//TODO: 测试用，可删除
@interface NewsDetailModel : BussinessModel

@property (nonatomic, copy) NSString *author;
@property (nonatomic, copy) NSString *ddateline;
@property (nonatomic, copy) NSString *isNew;
@property (nonatomic, copy) NSString *type;
@property (nonatomic, copy) NSString *addtime;
@property (nonatomic, copy) NSString *message_str;
@property (nonatomic, copy) NSString *dateline;
@property (nonatomic, copy) NSString *sid;
@property (nonatomic, copy) NSString *note;
@property (nonatomic, copy) NSString *msgId;
@property (nonatomic, copy) NSString *ppic;
@property (nonatomic, copy) NSString *uid;
@property (nonatomic, copy) NSString *idtype;
@property (nonatomic, copy) NSString *tagname;
@property (nonatomic, copy) NSString *pic;
@property (nonatomic, assign) NSInteger answer_type;
@property (nonatomic, copy) NSString *r_status;
@property (nonatomic, copy) NSString *avatar;
@property (nonatomic, copy) NSString *authorid;
@property (nonatomic, copy) NSString *mtalkid;
@property (nonatomic, copy) NSString *status;
@property (nonatomic, copy) NSString *s_status;
@property (nonatomic, copy) NSString *tagid;
@property (nonatomic, copy) NSString *mgpic;

@end

typedef enum {
  MessageFrom_Mine = 0,
  MessageFrom_Other
} MessageFrom_E;

typedef enum {
  MessageType_OnlyText = 0,
  MessageType_Pic, //图片
} MessageType_E;

@interface MessageModel : BussinessModel

@property (nonatomic, readwrite) MessageType_E type;   //区分text和image
@property (nonatomic, readwrite) MessageFrom_E sender; //区分me和other
@property (nonatomic, readwrite) CGFloat textCellHeight;
@property (nonatomic, strong) NSString *text;
@property (nonatomic, strong) NewsDetailModel *model;

- (instancetype)initWithNote:(NSString *)text sender:(MessageFrom_E)sender type:(MessageType_E)type;

@end

/**
 *  扩展字段实体
 */
@interface Ext : BussinessModel

@property (nonatomic, copy) NSString *avatar; //头像
@property (nonatomic, copy) NSString *uid;
@property (nonatomic, copy) NSString *nickname;   //昵称
@property (nonatomic, strong) NSString *username; //dj_uid

@end

/**
 *  图片实体
 */
@interface PicModel : BussinessModel

@property (nonatomic, copy) NSString *thumbnail_pic; //默认缩略图
@property (nonatomic, copy) NSString *bmiddle_pic;   //大图
@property (nonatomic, copy) NSString *original_pic;  //原始图片

//上传图片
+ (void)uploadPicWithImage:(UIImage *)image
                completion:(void (^)(PicModel *pic))completion;

@end
